package com.linys.scala.qf.day02

/**
  * lazy定义惰性变量，单例模式，jdbc驱动类
  */
class ScalaLazyDemo {
}

object ScalaLazyDemo {

  def init(): Unit = {
    println("call init()")
  }

  def main(args: Array[String]): Unit = {
    val property = init()
    println("after.init()")
    println(property)
  }
}

object ScalaLazyDemo2 {

  def init(): Unit = {
    println("call init()")
  }

  def main(args: Array[String]): Unit = {
    lazy val property = init()
    println("after.init()")
    println(property)
  }
}
